<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>看房记录</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/renting/css/public.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/renting/css/layui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/header.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/bottom.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/tenant_public.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/tenant_inspection.css"/>
    <style type="text/css">
        .link a:nth-last-of-type(0){
            display: block;
            margin:0px;
            padding:0px ;
        }
        .link a{
            display: block;
        }
        .link{
            margin-top: -12px;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="nav">
        <a href="${pageContext.request.contextPath}/renting/index.jsp" class="nav_title">好客租房</a>
        <select class="select">
            <option value="重庆">重庆</option>
            <option value="贵阳">贵阳</option>
            <option value="重庆">重庆</option>
            <option value="贵阳">贵阳</option>
        </select>
        <ul class="nav_ul">
            <li><a href="${pageContext.request.contextPath}/renting/index.jsp">首页</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/onther/Findroom.jsp">轻松找房</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/onther/entry.jsp">房东入驻</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/onther/chat_news.jsp">消息</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/onther/login.jsp" style="color: #2981c8;">登录</a></li>
        </ul>
        <img src="${pageContext.request.contextPath}/renting/img/icon/lianxi-1.png" class="nav_img" style="margin-top: -20px;">
        <p class="nav_phone">
            <span>13301131116</span>
            <span>13301131116</span>
        </p>
    </div>
</div>
<div class="body">
    <div class="portrait_bg">
        <div class="portrait">
            <a href="${pageContext.request.contextPath}/renting/pages/onther/personal.jsp" class="headImg">
                <img style="width: 100px;height: 100px;border-radius: 50%" src="../../img/${drom.avater}">
            </a>
        </div>
        <p class="nickname">点击头像编辑个人资料</p>
    </div>
    <div class="content">
        <ul class="left_ul">
            <li class="li_active"><a href="${pageContext.request.contextPath}/renting/pages/tenant/inspection.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >看房记录</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/tenant/appointment.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >我的预约</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/tenant/order.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >我的订单</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/tenant/collection.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >我的收藏</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/tenant/wallet.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >我的钱包</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/tenant/ID_verification.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >身份验证</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/tenant/contract.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >电子合同</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/tenant/about.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >联系我们</a></li>
        </ul>
        <div class="right_body">
            <div class="right_content">
                <div class="right_title">
                    <p>看房记录</p>
                </div>
                <div class="stripe">
                    <span>已查看的房源或小区</span>
                    <span>月租金</span>
                    <span>查看人数</span>
                    <span>操作</span>
                </div>
                <div id="addContentTo" class="right_main">

                </div>
            </div>
        </div>
        <div style="clear: both;"></div>
    </div>
</div>
<div class="bottom">
    <p>沪公网安备 31011402005354号</p>
</div>
</body>
</html>
<script src="${pageContext.request.contextPath}/renting/js/jQuery-3.4.1.js"></script>
<script>
    $(function (){
        var txt={"userId":${drom.rid},"status":"已看房"};
        $.ajax({
            url:"${pageContext.request.contextPath}/userInfo/queryTenantHouseViewLimit?limit=3&page=1",
            type:"post",
            async:false,
            data:"condition="+JSON.stringify(txt),
            dataType:"JSON",
            success:(rs)=>{
                console.log(rs.list);
                $.each(rs.list,function (i,j){
                    //var createTime = j.createTime;
                    // if(createTime!=null){
                    //     var date = new Date(createTime);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
                    //     Y = date.getFullYear() + '-';
                    //     M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
                    //     D = date.getDate() + ' ';
                    //     createTime = Y+M+D;
                    // }
                    var Listings=$(' <div class="item">' +
                        '<div class="item_img">' +
                        '<img src="${pageContext.request.contextPath}/renting/img/'+j.housePicture+'" >' +
                        '<div class="item_info">' +
                        '<p>'+j.communityName+'</p>' +
                        '<p>【'+j.name+'】'+j.communityAddress+'</p>' +
                        '<p>'+j.renovationCondition+'<span>'+j.houseType+'</span>'+j.towards+'</p>' +
                        '</div>' +
                        '</div>' +
                        '<span>￥'+j.rentalPrice+'</span>' +
                        '<span style="color: black;">'+j.browseNumber+'人已查看</span>' +
                        '<span class="link"><a href="${pageContext.request.contextPath}/house/queryHouseById?rid='+j.rid+'&showWi=2">查看信息</a>' +
                        '<a id="hid'+j.rid+'" href="${pageContext.request.contextPath}/renting/pages/tenant/inspection_commit.jsp?hid='+j.rid+'">提交订单</a>&emsp;' +
                        '<a style="margin-top:-25px;" href="${pageContext.request.contextPath}/renting/pages/tenant/appointment_cancel.jsp?appoinId='+j.aid+'">删除记录</a>' +
                        '</span>' +
                        '</div>');
                    Listings.appendTo("#addContentTo");

                })
            }
        });


        //二次验证状态
        $.ajax({
            url:'${pageContext.request.contextPath}/order/gethouseids',
            type:'post',
            async:false,
            dataType:"json",
            success:function (redata){
                console.log(redata)
                var data = redata.data;
                if(data!=null){
                    for(var ia=0;ia<data.length;ia++){
                        $("#hid"+data[ia]).text("");

                    }
                }
            },
            error:function (e){
                console.log(e);
            }



        })








    });

</script>
<script src="${pageContext.request.contextPath}/renting/layui.js"></script>
<script src="${pageContext.request.contextPath}/renting/js/header.js"></script>
<script type="text/javascript">
    judge_login("${pageContext.request.contextPath}/renting/pages/tenant/inspection.jsp","${pageContext.request.contextPath}/renting/pages/onther/login.jsp");
</script>
<script src="${pageContext.request.contextPath}/renting/js/ScrollHolder.js"></script>
